package com.procurement.bidding.controller;

import java.util.List;
import java.util.Map;

import com.procurement.bidding.domain.PcmBiddingDemandMain;
import com.procurement.bidding.service.IPcmBiddingDemandMainService;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;

import javax.servlet.http.HttpServletResponse;

/**
 * 招标需求主Controller
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/demand")
public class PcmBiddingDemandMainController extends BaseController
{
    @Autowired
    private IPcmBiddingDemandMainService pdms;
    @GetMapping("/demandList")
    public TableDataInfo showAllLj(String demandNumber) {
        startPage();
        List<PcmBiddingDemandMain> pdmsList = pdms.showAllLj(demandNumber);
        return getDataTable(pdmsList);
    }

    @PostMapping("/applicationList")
    public List<Map<String,Object>> showAllMx(@RequestParam Map<String,Object> map) {
        startPage();
        return pdms.showAllMx(map);
    }

    @PostMapping("/addDemandMain")
    public AjaxResult insertDemandMain(@RequestBody Map<String, Object> map) {
        System.out.println(map+"********************");
        return toAjax(pdms.insertDemandMain(map));
    }

    @PostMapping("findAllByProjectID")
    public TableDataInfo findAllByProjectID(@RequestBody Map<String,Integer> map) {
        System.out.println(map.get("projectID"));
        return getDataTable(pdms.findAllByProjectID(map.get("projectID")));
    }

    @PostMapping("updateByProjectID")
    public AjaxResult updateByProjectID(@RequestBody Map<String,Object> map){
        return toAjax(pdms.updateDemandMain(map));
    }

    @PostMapping("delProjectID")
    public AjaxResult delProjectID(@RequestBody List<Integer> lists){
        return toAjax(pdms.delDemandMain(lists));
    }


    //添加招标项目
    @PostMapping("/addProject")
    public AjaxResult addProject(@RequestBody Map<String,Object> map){
        System.out.println(map+"***************");
//        pdms.addProject(map);
        return toAjax(1);
    }
}
